import java.util.Scanner;
public class Hanota01 {
    public static void main(String[] args) {
        System.out.println("请输入汉诺塔圆盘数:");
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        hm(n, 'A', 'B', 'C');
    }

    public static void hm(int m, char a, char b, char c) {
        if (m == 1) {
            System.out.println("A -> C");
        } else {
            hm(m - 1, a, c, b);
            System.out.println(a +"->"+ c);
            hm(m - 1, b, a, c);
        }
    }
}
